import * as types from './mutation-types'

let animation
export const setShowCompIndex = function ({ commit, state }, index) {
  if (this.state.showCompIndex == index) {
    return
  }

  if (animation) {
    return
  }
  animation = true
  setTimeout(() => animation = false, 250)

  commit(types.SET_PREVCOMPINDEX, state.showCompIndex)
  commit(types.SET_SHOWCOMPINDEX, index)

}


